(function(){
	for (var i = 0; i < document.links.length; i++) {
	  var a = document.links[i];
	  if(!/^https?:\/\/docs.google.com\/viewer\?url=/.test(a.href) && 
	      /^.*\.(pdf|pages|ai|psd|tiff|dxf|svg|eps|ps|ttf|xps|zip|rar|((doc|xls|ppt)x?))$/i.test(a.href)){
		a.href = "http://docs.google.com/viewer?url=" + encodeURIComponent(a.href);
	  }
/*	  if(!/^https?:\/\/docs.google.com\/viewer\?url=/.test(a.href)){
		  a.href = a.href.replace(/^.*\.(pdf|pages|ai|psd|tiff|dxf|svg|eps|ps|ttf|xps|zip|rar|((doc|xls|ppt)x?))$/i, function(match){
			return "http://docs.google.com/viewer?url=" + encodeURIComponent(match);
		  });
	  }*/
	}
})()